﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Admin.Controls
{
    public partial class AddDienTich : System.Web.UI.UserControl
    {
        public string filePathSlide;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {

            int nextid = Convert.ToInt32(DAL.DCollector.DBCollector.Instance.getNextID("tbl_DienTich", "DienTich_ID"));
            if (txtFrom.Text != "")
            {
                if (txtTo.Text != "")
                {
                    int idnextyahoo = nextid + 1;
                    string value = "" + idnextyahoo + "," + float.Parse(txtFrom.Text) + "," + float.Parse(txtTo.Text) + "";
                    List<string> values = new List<string>();
                    values.Add(value);
                    DAL.DCollector.DBCollector.Instance.StoredProcedureInsertByRows("tbl_DienTich", "insertonerow", values, false);
                    Response.Redirect("/Admin/Index.aspx?panel=1&sub=2");
                }
                else
                {
                    Response.Write("<script>alert('Vui lòng nhập diện tích đến...')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Vui lòng nhập diện tích từ...')</script>");
            }
        }
    }
}